package com.atXiao.video.controller;

import com.atXiao.video.common.entity.ResBody;
import com.atXiao.video.dto.ChatModel;
import com.atXiao.video.entity.req.video.VideoDownloadReq;
import com.atXiao.video.entity.resp.video.VideoDownloadResp;
import com.atXiao.video.utils.ChatGptUntil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: lixiaoxiao
 * @date: 2023/5/24 14:47
 * @version: 1.0
 * @desc:
 */
@RestController
@RequestMapping("/third")
public class ChatGptController {


    @Autowired
    ChatGptUntil chatGptUntil;


    @PostMapping("/ask")
    public String videoDownload(@RequestBody String context) throws IOException {
        List<ChatModel> messagelist = new ArrayList<>();
        ChatModel chatModel = new ChatModel();
        chatModel.setRole("user");
        chatModel.setContent(context);
        messagelist.add(chatModel);
        String response = chatGptUntil.getRespost(1L, messagelist);
        return response;

    }


}
